package utils

import (
	"server/internal/config"

	"github.com/zeromicro/go-zero/core/stores/redis"
	"gorm.io/gorm"
)

var Db *gorm.DB
var Rds *redis.Redis
var Conf config.Config

func Init(db *gorm.DB, rds *redis.Redis, config config.Config) {
	Db = db
	Rds = rds
	Conf = config
	AutoMigrate()
}

func FilterConfig(c *config.Config) {
	c.RestConf.Middlewares.Trace = false
	c.RestConf.Middlewares.Prometheus = false
	c.RestConf.Middlewares.Breaker = false
	c.RestConf.Middlewares.Shedding = false
	c.RestConf.Middlewares.Metrics = false
	c.RestConf.Middlewares.MaxBytes = false
	c.RestConf.ServiceConf.DevServer.Enabled = false
	c.RestConf.ServiceConf.DevServer.EnableMetrics = false
	c.RestConf.ServiceConf.DevServer.EnablePprof = false
	c.RestConf.ServiceConf.Log.Stat = false
}
